<app:account-edit-page page-title='Auth Tokens'>
<div class='account-auth-tokens'>
<div class='account-block'>
<div class='account-auth-tokens__introduction'>
You can create tokens to authenticate to our Web API endpoints in external tools.
These tokens allow to skip solving CAPTCHA on login, but rate limiting is applied.
<a app-nw-external-link href='http://docs.screeps.com/auth-tokens.html' target='_blank'>Learn more</a>
</div>
<div class='account-option' ng-repeat='token in AccountAuthTokens.data.tokens'>
<md-button app-click-animated='AccountAuthTokens.removeToken(token._id)' class='account-auth-tokens__remove' tooltip-append-to-body='true' uib-tooltip='Remove'>
<div class='fa fa-remove'></div>
</md-button>
<md-button class='account-auth-tokens__disable-rate-limit' ng-click='AccountAuthTokens.disableRateLimiting(token.token)' tooltip-append-to-body='true' uib-tooltip='Turn off rate limiting for 2 hours'>
<div class='fa fa-unlock-alt'></div>
</md-button>
<div class='account-auth-tokens__token-key'>
{{token.token}}
</div>
<div class='account-auth-tokens__token-description'>
{{token.description}}
</div>
<div class='account-auth-tokens__token-noratelimit' ng-if='token.noRatelimitUntil &gt; AccountAuthTokens.now()'>
Not rate limited until {{token.noRatelimitUntil | date:'shortTime'}}
</div>
<div class='account-auth-tokens__token-access'>
<div ng-if='token.full'>Full access</div>
<div ng-repeat='event in token.websockets'>
WebSockets ({{event}})
</div>
<div ng-repeat='endpoint in token.endpoints'>
{{endpoint}}
</div>
<div ng-if='token.memorySegments'>
Memory segments: {{token.memorySegments.join(', ')}}
</div>
</div>
</div>
</div>
<div class='account-block'>
<h4>Add new auth token</h4>
<form>
<md-input-container class='account-auth-tokens__description'>
<label>Description (optional)</label>
<input ng-model='AccountAuthTokens.addForm.description'>
</md-input-container>
<md-radio-group ng-model='AccountAuthTokens.addForm.type'>
<md-radio-button value='full'>Full access</md-radio-button>
<md-radio-button value='selected'>Only selected endpoints:</md-radio-button>
</md-radio-group>
<div class='account-auth-tokens__selected-endpoints' ng-if="AccountAuthTokens.addForm.type == 'selected'">
<div>
<md-checkbox ng-model="AccountAuthTokens.addForm.websockets['console']">WebSockets (console)</md-checkbox>
</div>
<div>
<md-checkbox ng-model="AccountAuthTokens.addForm.websockets['rooms']">WebSockets (rooms)</md-checkbox>
</div>
<div ng-repeat='(endpoint,value) in AccountAuthTokens.addForm.endpoints'>
<md-checkbox ng-model='AccountAuthTokens.addForm.endpoints[endpoint]'>{{endpoint}}</md-checkbox>
</div>
<div ng-if="AccountAuthTokens.addForm.type == 'selected' &amp;&amp; (AccountAuthTokens.addForm.endpoints['GET /api/user/memory-segment'] || AccountAuthTokens.addForm.endpoints['POST /api/user/memory-segment'])">
<md-input-container>
<label>Memory segments</label>
<input ng-model='AccountAuthTokens.addForm.memorySegments'>
<div class='account-auth-tokens__note'>
Specify memory segments IDs separated by a comma or space. Leave blank to allow access to all memory segments.
</div>
</md-input-container>
</div>
</div>
</form>
<div class='account-controls'>
<div class='pull-right'>
<md:button app-click-animated='AccountAuthTokens.generateToken()' class='md-primary md-hue-1'>Generate token</md:button>
</div>
</div>
</div>
</div>
</app:account-edit-page>
